/*
 * jiyan1
 */

package com.jiyan.account.dao;

import com.rzhkj.core.base.BaseMybatisDAOImpl;
import org.springframework.stereotype.Repository;
import com.jiyan.account.entity.Account;

/**
 * 账户
 * @author jiyan
 */
@Repository
public class AccountDAO extends BaseMybatisDAOImpl<Account,Long>{

    /**
     * 加载一个对象账户 通过code
     * @param code 编码
     * @return Account
     */
    public Account loadByCode(java.lang.String code) {
        return getSqlSession().selectOne(this.sqlmapNamespace+".loadByCode",code);
    }

    /**
     * 更新对象账户 通过code
     * @param code 编码
     */
    public void updateByCode(Account accountObj,java.lang.String code) {
        if(code!=null){
           accountObj.setCode(code);
        }
        getSqlSession().update(this.sqlmapNamespace+".update",accountObj);
    }

    /**
     * 删除对象账户
     * @param id id@param code 编码@param account 账户
     */
    public void delete(java.lang.Long id,java.lang.String code,java.lang.String account) {
        Map<String,Object> map= new HashMap<String,Object>();
        if(id!=null){
           map.put("id",id);
        }
        if(code!=null){
           map.put("code",code);
        }
        if(account!=null){
           map.put("account",account);
        }
        getSqlSession().delete(this.sqlmapNamespace+".delete",map);
   }
    /**
     * 加载一个对象账户 通过account
     * @param account 账户
     * @return Account
     */
    public Account loadByAccount(java.lang.String account) {
        return getSqlSession().selectOne(this.sqlmapNamespace+".loadByAccount",account);
    }

    /**
     * 更新对象账户 通过account
     * @param account 账户
     */
    public void updateByAccount(Account accountObj,java.lang.String account) {
        if(account!=null){
           accountObj.setAccount(account);
        }
        getSqlSession().update(this.sqlmapNamespace+".update",accountObj);
    }

    /**
     * 删除对象账户
     * @param id id@param code 编码@param account 账户
     */
    public void delete(java.lang.Long id,java.lang.String code,java.lang.String account) {
        Map<String,Object> map= new HashMap<String,Object>();
        if(id!=null){
           map.put("id",id);
        }
        if(code!=null){
           map.put("code",code);
        }
        if(account!=null){
           map.put("account",account);
        }
        getSqlSession().delete(this.sqlmapNamespace+".delete",map);
   }
}
